package lock.lntelligence.gjx.fragment;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import lock.lntelligence.gjx.R;
import lock.lntelligence.gjx.activity.DoActivity;
import lock.lntelligence.gjx.activity.ManagerUserActivity;
import lock.lntelligence.gjx.activity.OpenLogActivity;
import lock.lntelligence.gjx.activity.VoiceActivity;

/**
 * A simple {@link Fragment} subclass.
 */
public class ManagerFragment extends Fragment implements View.OnClickListener {


    private View mInflate;

    public ManagerFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (mInflate == null) {
            mInflate = inflater.inflate(R.layout.fragment_manager, null);
            setListener();
        }
        return mInflate;
    }

    private void setListener() {
        mInflate.findViewById(R.id.textView_yonghuaguanli).setOnClickListener(this);
        mInflate.findViewById(R.id.textView_kaimenjilu).setOnClickListener(this);
        mInflate.findViewById(R.id.textView_shipinchakan).setOnClickListener(this);
        mInflate.findViewById(R.id.textViewyuyinduijiang).setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        Intent intent = new Intent();
        switch (view.getId()) {
            case R.id.textView_yonghuaguanli:
                intent.setClass(getActivity(), ManagerUserActivity.class);
                ((DoActivity)getActivity()).isNotSleep=false;
                startActivity(intent);
                break;
            case R.id.textView_kaimenjilu:
                intent.setClass(getActivity(), OpenLogActivity.class);
                ((DoActivity)getActivity()).isNotSleep=false;
                startActivity(intent);
                break;
            case R.id.textView_shipinchakan:
                Toast.makeText(getActivity(), "视频查看", Toast.LENGTH_SHORT).show();
                break;
            case R.id.textViewyuyinduijiang:
                intent.setClass(getActivity(), VoiceActivity.class);
                ((DoActivity)getActivity()).isNotSleep=false;
                startActivity(intent);
                break;
        }
    }

}
